package cn.dy.sbo.util;

import java.util.Locale;
import java.util.ResourceBundle;

import org.springframework.web.servlet.i18n.SessionLocaleResolver;
import org.springside.modules.utils.web.struts2.Struts2Utils;

import com.opensymphony.xwork2.ActionContext;

public class ResourceBundleMessageSource extends org.springframework.context.support.ResourceBundleMessageSource{
	
	@Override
	protected ResourceBundle getResourceBundle(String basename, Locale locale) {
		Object obj  = null;
		if(ActionContext.getContext() != null)
			obj = Struts2Utils.getSession().getAttribute(SessionLocaleResolver.LOCALE_SESSION_ATTRIBUTE_NAME);
		if(obj == null)
			obj = locale;
		return super.getResourceBundle(basename,(Locale) obj);
	}
	
}
